package com.reform.controller.project;


import com.reform.res.Result;
import com.reform.service.INumProjectService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 前端控制器
 * </p>
 *
 * @author mortale
 * @since 2021-08-06
 */
@Api(tags = "NumProjectController")
@RestController
@RequestMapping("/num-project")
public class NumProjectController {

    @Autowired
    INumProjectService numProjectService;

    @ApiOperation(value = "获取所有项目数信息")
    @PostMapping("getAllNumProject")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "batchId", value = "批次id", paramType = "query", dataTypeClass = String.class, required = true),
    })
    public Result getAllNumProjectByBatchId(String batchId) {
        return numProjectService.getAllNumProjectByBatchId(batchId);
    }

    @ApiOperation(value = "设置项目最大通过数")
    @PostMapping("setNumProject")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "numProId", value = "最大项目编号", paramType = "query", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "maxPronum", value = "最大项目数", paramType = "query", dataTypeClass = String.class, required = true),
    })
    public Result setNumProject(Integer numProId, String maxPronum) {
        return numProjectService.setNumProject(numProId, maxPronum);
    }

    @ApiOperation(value = "批量设置项目最大通过数")
    @PostMapping("setNumProjects")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "numProIds", value = "最大项目编号", paramType = "query", dataTypeClass = String.class, required = true),
            @ApiImplicitParam(name = "maxPronums", value = "最大项目数", paramType = "query", dataTypeClass = String.class, required = true),
    })
    public Result setNumProjects(String numProIds, String maxPronums) {
        return numProjectService.setNumProjects(numProIds, maxPronums);
    }

    @ApiOperation(value = "编辑已授权部门")
    @PostMapping("editDepartment")
    @ApiImplicitParams({
            @ApiImplicitParam(name = "numProId", value = "最大项目编号", paramType = "query", dataTypeClass = Integer.class, required = true),
            @ApiImplicitParam(name = "isEmpower", value = "是否授权（0->否，1->是）", paramType = "query", dataTypeClass = Integer.class, required = true),
    })
    public Result editDepartment(Integer numProId, Integer isEmpower) {
        return numProjectService.editDepartment(numProId, isEmpower);
    }


}
